import request from '@/utils/request'
/* 连接列表 */
export function kafkaAll(param) {
    return request({
        url: '/sjcc/kafka/all',
        method: 'get',
        params: param,
    })
}

/* 连接 */
export function kafkaConnect(param) {
    return request({
        url: '/sjcc/kafka/connect',
        method: 'post',
        data: param,
    })
}

/* 新增连接 */
export function kafkaConnectAdd(data) {
    return request({
        url: '/sjcc/kafka/add',
        method: 'post',
        data,
    })
}

/* 修改连接 */
export function kafkaConnectUpdate(data) {
    return request({
        url: '/sjcc/kafka/update',
        method: 'put',
        data,
    })
}

/* 删除连接 */
export function kafkaConnectDelete(params) {
    return request({
        url: '/sjcc/kafka/delete',
        method: 'delete',
        params,
    })
}

/* 连接详情 */
export function kafkaConnectDetail(param) {
    return request({
        url: '/sjcc/kafka/connect/detail',
        method: 'get',
        params: param,
    })
}
/* 测试连接 */
export function kafkaConnectTest(data) {
    return request({
        url: '/sjcc/kafka/testConnection',
        method: 'post',
        data,
    })
}

/* topic信息 */
export function kafkaTopicData(param) {
    return request({
        url: '/sjcc/kafka/topic',
        method: 'get',
        params: param,
    })
}
/* 主题列表 */
export function kafkaTopicPage(topic, param) {
    return request({
        url: `/sjcc/kafka/${topic}/data`,
        method: 'get',
        params: param,
    })
}

/* 主题新增 */
export function kafkaTopicAdd(data) {
    return request({
        url: '/sjcc/kafka/topic',
        method: 'post',
        data,
    })
}
/* 主题分区 */
export function kafkaTopicPartitions(topic, params) {
    return request({
        url: `/sjcc/kafka/${topic}/partitions`,
        method: 'get',
        params,
    })
}
/* topic发送数据 */
export function kafkaTopicPost(data) {
    return request({
        url: `/sjcc/kafka/${data.topic}/data?id=` + data.id,
        method: 'post',
        data,
    })
}
/* 批量删除topic */
export function kafkaTopicBatchDelete(id, data) {
    return request({
        url: `/sjcc/kafka/batch-delete?id=` + id,
        method: 'post',
        data,
    })
}

/* 获取broker列表 */
export function kafkaBrokerList(id) {
    return request({
        url: `/sjcc/kafka/brokers?id=` + id,
        method: 'get',
    })
}
/* 获取consumer列表 */
export function kafkaConsumerList(params) {
    return request({
        url: `/sjcc/kafka/consumerGroups`,
        method: 'get',
        params,
    })
}